package com.heyapei.test;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 何亚培
 * @version V1.0
 * @Date 2019/4/19 15:14
 * @Description: TODO
 */
@WebServlet("/hello")
public class Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("hello-begin");
        System.out.println(req.getContextPath());
        System.out.println(req.getServletPath());
        System.out.println(req.getRequestURI());
        System.out.println(req.getRequestURL());
        System.out.println(req.getServletContext().getRealPath("/"));
        System.out.println(req.getServletContext().getRealPath("/WEB-INF/upload"));
        System.out.println(req.getServerName());
        System.out.println(req.getServerPort());
        System.out.println(req.getLocalAddr());
        System.out.println(req.getLocalName());
        System.out.println(req.getLocale());
        System.out.println(req.getLocales());
        System.out.println(req.getLocalPort());
        System.out.println("hello-end");
    }
}
